package com.nbjtjc.safe.mapper.edu;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.nbjtjc.safe.model.edu.EduPlanItem;
import com.nbjtjc.safe.model.edu.EduPlanList;
import com.nbjtjc.util.MyMapper;

@Mapper
public interface EduPlanItemMapper extends MyMapper<EduPlanItem> {
	@Select("select * from edu_plan_item where plan_id = #{planId}")
	List<EduPlanItem> findByPlanId(@Param("planId") int planId);
	
	@Delete("delete from edu_plan_item where  plan_id = #{planId}")
	int deleteByPlanId(@Param("planId") int planId);
	
    @Insert("INSERT edu_plan_item(plan_id,plan_items,remark,item_temp_id)"
    		+"(SELECT #{planId} AS plan_id,item AS plan_items,remark,id AS item_temp_id FROM edu_plan_templet WHERE cancel = 0)")
	int insertItemByTemplet(@Param("planId") int planId);
}